<script src="jscript/DynamicOptionList.js" type="text/javascript"></script>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
	var UpdateSort = new DynamicOptionList("sort_order","parent_id");
	
	<tmpl:js_option_list>
	UpdateSort.addOptions({js_option_list_values});
	UpdateSort.setDefaultOption({js_option_default});
	</tmpl:js_option_list>
	
	function ShowHideRoles() {
		var obj = document.getElementById("private");
		if(obj) {
			var val = (obj.checked == true);
			ShowHideDiv('roles_div', val, true);
		}
	}
//-->
</SCRIPT>

<tmpl:private>
{xajax_js}
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--	
	function ShowHideRolesXajax(val) {
		var obj = document.getElementById("private");
		if(val != 0) {
			obj.checked = true;
			ShowHideDiv('roles_div', true, true);
		} else {
			obj.checked = false;
			ShowHideDiv('roles_div', false, true);		
		}
	}	
	
	function AssignPrivateFromParent(is_private, roles_ids) {
		ShowHideRolesXajax(is_private);
		selectAll(true, 'member_role', roles_ids);
	}
//-->
</SCRIPT>
</tmpl:private>

{error_msg}

<!-- onSubmit="return Validate(this);" -->
<form action="{action_link}" method="post" name="category" id="category">
{hidden_fields}

<table border=0 width="100%" cellpadding="5" cellspacing="1">
<tr>
	<td colspan="2" class="tdTitle"><b>{action_title}</b></td>
</tr>

<tr class="trlighter">
	<td class="tdFormCaption" nowrap>{name_msg}: {required_sign}</td>
	<td><input type="text" name="name" value="{name}" class="longText"></td>
</tr>
<tr class="trlighter">
	<td valign="top" class="tdFormCaption">{description_msg}:</td>
	<td width="90%"><textarea cols="80" rows="2" name="description">{description}</textarea></td>
<tr> 

<tr class="trlighter">
	<td class="tdFormCaption" nowrap valign="top">{parent_category_msg}: {required_sign}</td>
	<td>
		<select name="parent_id" id="parent_id" size="6" style="width: 250px;" onChange="UpdateSort.populate();">
		{category_select}
		</SELECT>
	</td>
</tr>
<tr class="trlighter">
	<td class="tdFormCaption" valign="top">{sort_order_msg}:</td>
	<td>
		<SELECT style="WIDTH: 250px" size="1" name="sort_order">
		<SCRIPT language="JavaScript">UpdateSort.printOptions();</SCRIPT>
		</SELECT>
	</td>
</tr>

<tmpl:private>
<tr class="trlighter">
	<td class="tdFormCaption" nowrap valign="top">{private_msg}:</td>
	<td>
		<input type="checkbox" name="private" id="private" value="1" {private_options} onClick="ShowHideRoles()"> {yes_msg}
		
		<span style="margin-left: 10px;">
		<a href="javascript:xajax_addParentRoles(document.getElementById('parent_id').value); void(0);"
			title="{copy_from_parent_category_msg}">
			<img src="images/icons/assign.gif" width="16" height="15" alt="{copy_from_parent_category_msg}" border="0">
		</a>
		</span>
		
		<div id="roles_div" style="display: none">
			<div style="padding: 8px 0px;">{role_access_msg}:&nbsp;&nbsp;
				<a href="javascript:selectAll(true, 'member_role'); void(0);">{all_msg}</a> |
				<a href="javascript:selectAll(false, 'member_role'); void(0);">{none_msg}</a>
			</div>
			
			<select name="member_role[]" id="member_role" size="4" multiple style="WIDTH: 250px">
				{member_role_select}
			</select>
		</div>
		
	</td>
</tr>
</tmpl:private>

<tr class="trlighter">
	<td class="tdFormCaption" nowrap>{status_msg}:</td>
	<td>{status_checkbox}</td>
</tr>

<tr>
	<td></td>
	<td><div><br></div>
		<input type="submit" name="submit" value="{ok_msg}" class="button">
		<input type="button" value="{cancel_msg}" onClick="location.href='{cancel_link}'" class="button">
	</td>
</tr>
</table>
</form>

<img src="images/s.gif" width="1" height="1" alt="" 
	onLoad="UpdateSort.init(document.forms['category']); ShowHideRoles();">